home *** CD-ROM | disk | FTP | other *** search
- /************************************************/
- /* Sample DLL's */
- /* Copyright © Vincent Parsons 1989. */
- /************************************************/
- /* DLL code for MPW C 3.0 or THINK C 4.0 */
- /* with Excel for the Macintosh 2.2 */
- /* and Microsoft C 5.1 */
- /* with Excel for Windows 2.1 */
- /************************************************/
- /* SampFHF is an example of one data type H */
- /* input and one data type F output. The */
- /* output is the ASCII hex representation of */
- /* the type H input. The answer has been */
- /* stored in the Excel buffer reserved by the */
- /* type F input variable. */
- /************************************************/
- /* =REGISTER("SampDLLs","SampFHF","FHF") */
- /* for both the Mac and the PC. */
- /************************************************/
-
- #include "DLL.h"
-
- #if applec
- #include <Types.h>
-
- #elif MSDOS
- #include <windows.h>
-
- #endif
-
- #if THINK_C
- pascal char * main(unsigned short u1, char * c1); /* prototype */
-
- pascal char * main(u1, c1)
- unsigned short u1;
- char * c1;
-
- #elif applec
- pascal char * SampFHF(unsigned short u1, char * c1)
-
- #elif MSDOS
- char far * far pascal SampFHF(unsigned short u1, char far * c1)
- #endif
- {
- short i;
-
- for (i = 3; i >= 0; i--) { /* C String */
- c1[i] = u1 & 0xF; /* Get nibble */
- if (c1[i] <= 9) c1[i] += '0';
- else c1[i] += 55; /* Make ASCII hex */
- u1 = u1 >> 4; /* Get next nibble */
- }
- c1[4] = 0;
-
- return (c1);
- }
-
- /************************************************/
-